package com.css.zfzx.sjcj.modules.hddcGeochemicalAbnPoint.service.impl;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.css.bpm.platform.utils.PlatformObjectUtils;
import com.css.zfzx.sjcj.common.excel.util.ActiveFaultEasyExcelVerifyHelper;
import com.css.zfzx.sjcj.modules.hddcGeochemicalAbnPoint.viewobjects.HddcGeochemicalabnpointVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * <p>地球化学探测数据-地球化学探测异常点-点管理, Excel导入校验</p>
 *
 * @author liuhy
 * @date 2021/8/30
 */
@Component
public class GeochemicalExploreExceptionPointExcelVerifyHandler implements IExcelVerifyHandler<HddcGeochemicalabnpointVO> {

    private final ActiveFaultEasyExcelVerifyHelper helper;

    @Autowired
    public GeochemicalExploreExceptionPointExcelVerifyHandler(ActiveFaultEasyExcelVerifyHelper helper) {
        this.helper = helper;
    }

    @Override
    public ExcelVerifyHandlerResult verifyHandler(HddcGeochemicalabnpointVO vo) {
        ExcelVerifyHandlerResult result = helper.verify(vo);
        if (PlatformObjectUtils.isEmpty(vo.getExtends5())) {
            result.setMsg("经度不能为空");
            result.setSuccess(false);
        } else if (PlatformObjectUtils.isEmpty(vo.getExtends6())) {
            result.setMsg("纬度不能为空");
            result.setSuccess(false);
        } else if (PlatformObjectUtils.isEmpty(vo.getTargetfaultsource())) {
            result.setMsg("目标断层来源不能为空");
            result.setSuccess(false);
        } else if (PlatformObjectUtils.isEmpty(vo.getSvylineid())) {
            result.setMsg("所属测线编号不能为空");
            result.setSuccess(false);
        }
        return result;
    }

}
